package com.ghy.util;
import com.alipay.easysdk.kernel.Config;
/**
 * @author GaoHeYang
 */
public class AlipayUtil {

    /** 应用ID */
    private static final String APPID = "9021000143672005";
    /** 异步通知接口（下单成功后支付宝回调） */
    private static final String NOTIFY_URL = "http://7ffecd4b.r31.cpolar.top/api/v1/order/prePayNotify";
    /** 支付宝公钥 */
    private static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Pw2/08EKGU/sbTpKqIYah5rL1+IgVkKFHagoQFt7dA7St2jHrPDha/fkdn1W21EI68VkbOQiOipqwzlTrORvLX6bOd1+4v9KdXC3vQI7lAny08w2zyXwWJOxdTfgKpH49psO+6uOLuQKWoXz1XQJiPBVJ59PQesfa+/0LRhMlhwHSjCRahaTa8W6ZH8iSVN9VSbOTNObQ7g54ZNYBvbRlr9HatsvNADmKcsi3G3E1nBNlT2J5nO8bHihPhhF9z/cHIenzZbjeTrKAgv/Cp/DDJE4+xWwjbMm+45zWj1kycRK+E2u8rH+dxvqClg/yivKifHWrdiAQqtmKp2Pf4KvwIDAQAB";
    /** 应用私钥 */
    private static final String MERCHANT_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCCpeBQPoYmJVbCobyPVES28Bc2jkecRD9LFVRnVyQn5fFwM2so/Vnl+3RLtETXjayu3IrWm65IonJJTxKRDDtTkYJh7U5maLpdKNcMNIee6G0u+qY3kcRFW38sTJQ3fzkiU/wdgRidW8q7n+X9zXZXgLvVs/ryAUWv6rPI5OjYGZHzvDuDPR6yBmvdcOgoELH3UggW23EJgQESH5fqOMB1GioF0nep/wtoGKJ2Uf5Xsgf6ZFjjhnRxdsjGAoPsJIJZCseli+VwO1f4TVQkw7hHq7WwFbkkdYfNwglvUYXDxvUF4X2vTqiuP3+wnQzhPlXwTQv9KCH+QnjX/Ae2NMyZAgMBAAECggEABO0KKxxgZHnN7qK4gFL2EEu3JFhy/M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ut3AMTzCvU6TxAkC5t9UGGw2D/iK39y1hxi42ecXF326CLBAp055+l84E057izPG7nE0BiZnvG2m+vFoJJ0KJxAgAUeVIT5H+UCp/PFj4rJ6y5aV05PNyyg==";
    /** 单例的Alipay配置对象 */
    private static volatile Config config;
    /** 单例对外方法 */
    public static Config getConfig() {
        if (config == null) {
            synchronized (AlipayUtil.class) {
                if (config == null) {
                    config = new Config();
                    config.protocol = "https";
                    config.gatewayHost = "openapi-sandbox.dl.alipaydev.com";
                    config.signType = "RSA2";
                    config.ignoreSSL = true;
                    config.appId = APPID;
                    config.alipayPublicKey = ALIPAY_PUBLIC_KEY;
                    config.merchantPrivateKey = MERCHANT_PRIVATE_KEY;
                    config.notifyUrl = NOTIFY_URL;
                }
            }
        }
        return config;
    }
}